<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
        var asyncI = {
            [Symbol.asyncIterator](){
                var self = this
                return {
                    i :0,
                    next() {
                        if(this.i < 3){
                            return new Promise((res, rej) => res({value:this.i++, done:false}))
                        }
                        return new Promise((res, rej) => res({value:this.i, done:true}))
                    }
                }
            }
        };

        (async function(){
            for await (let item of asyncI){
                console.log(item)
            }
        })()
    </script>
  </body>
</html>
